import { Controller, Inject, Injectable, OnModuleInit, UseFilters } from '@nestjs/common';
import { ClientGrpc } from '@nestjs/microservices';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { UserEntity } from 'src/user/user.entity';
import { CodeServiceClient, CODE_PACKAGE_NAME, CODE_SERVICE_NAME } from './code';

@Injectable()
export class GrpcService implements OnModuleInit {
  public service: CodeServiceClient;

  constructor(@Inject(CODE_SERVICE_NAME) private readonly client: ClientGrpc) {}

  onModuleInit() {
    this.service = this.client.getService(CODE_SERVICE_NAME);
  }
}
